package com.jaychen.spring.core.ioc;

import com.jaychen.spring.core.io.loader.ResourceLoader;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author Jay Chen
 * @Date 2020/11/9 19:17
 */
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {

    private ResourceLoader resourceLoader;

    /**
     * 已加载的bean
     * 在初始化{@link com.jaychen.spring.factory.config.AutowireCapableBeanFactory}的时候再去创建对应的bean
     */
    private final Map<String, BeanDefinition> registry = new ConcurrentHashMap<>();

    public AbstractBeanDefinitionReader(ResourceLoader resourceLoader) {
        this.resourceLoader = resourceLoader;
    }

    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }

    public Map<String, BeanDefinition> getRegistry() {
        return registry;
    }
}
